Electronic documents have proliferated as computers have become common fixtures in offices, schools and homes. In many instances, electronic documents have replaced paper documents. For example, an electronic document may be distributed instead of a paper memorandum. To encourage the use of an electronic document rather than a paper document, the text of the electronic document must be legible and linguistically accurate. The text of an electronic document is typically rendered using one or more fonts such as Arial, Times New Roman or Courier. A font is a particular style of typeface. A font designed for an electronic document is designed to increase the readability of the document when displayed on a pixel display device, such as a monitor or a printer. To render the text of an electronic document in a particular font, the text is represented by glyphs. A glyph is a representation of one or more characters. A single glyph may represent a single character such as the lower case letter "f" or a single glyph may represent a string of characters such as the lower case letters "fi". To render a document on a display device, the characters of the document are converted to glyphs and the glyphs are displayed on the display device.
Typically, font information, including glyph information, is stored in a set of font tables. For example, the OpenType Layout font standard promulgated by Microsoft Corporation of Redmond, Wa., assignee of the present invention, includes five font tables: (1) a glyph substitution table, (2) a glyph position table, (3) a justification table, (4) a baseline table, and (5) a glyph definition table. The OpenType Layout font tables support contextual mapping between characters and glyphs, including ligatures, positional forms, alternatives, and other substitutions.
A word processing program may use the information in the font tables to layout and render the text of an electronic document. An electronic document is laid out before the document is rendered on an output device such as a display device. Document layout typically includes paragraph layout. To layout a paragraph, a word processing program breaks the paragraph text into separate lines and then lays out each line separately. However, once a line is laid out, the line may expand or contract which may require that the word processing program re-break the paragraph text. If the word processing program re-breaks the text, then the text must also be laid out again. Repeatedly re-breaking and re-laying out the text increases the time required to render the paragraph. A paragraph could be rendered in less time if the repeated line breaking and lay out could be eliminated. The faster a paragraph is laid out, the faster a document may be displayed. For example, to display the twenty-fifth page of a document, the word processing program must layout twenty-five pages of text, each page of text typically having one or more paragraphs.
If justification is enabled, then each line of the paragraph must also be justified. A line may be justified by the word processing program by using justification suggestions stored in the font tables. The justification suggestions list particular actions that the word processing program may use to adjust the glyphs in a line of text.
To layout a paragraph or to justify text, a word processing program must be able to access and manipulate the font tables and the information contained in those tables. Such manipulation and utilization requires a level of complexity which may not be available in many word processing programs. Therefore, many of the advanced typography features available in the font tables, have not been utilized by word processing programs. If a word processing program could use an interface such as a layout services library to access and manipulate the font tables, then the word processing program could fully utilize the features available without needing an increased level of complexity.
Accordingly, there is a need in the art for a more efficient method for laying out a paragraph and justifying a line of text. There is also a need in the art for a layout services library to interface with the font tables to support paragraph layout and justification.